package JFrame;

import javax.swing.*;
import javax.swing.border.EmptyBorder;
import java.awt.*;

public class Tools {

    public static void setBorders(JComponent ... component){
        for (JComponent traver : component){
            traver.setBorder(new EmptyBorder(0,0,0,0));
        }
    }
    public static void addComponents(Container a, JComponent ... component){
        for (JComponent traver : component){
            a.add(traver);
        }
    }

    public static void emptying(JTextField ... textFields){     //
        for (JTextField traver:textFields){
            traver.setText("");
        }
    }



    public static void setFonts(int size,int ifBold,JComponent ... component){     //
        Font font=new Font("楷体",ifBold,size);
        for (JComponent traver : component){
            traver.setFont(font);
        }
        UIManager.put("OptionPane.messageFont", font);
    }

    public static void setTextFieldCenter(JTextField ... textFields){
        for (JTextField traver:textFields){
            traver.setHorizontalAlignment(JTextField.CENTER);
        }
    }

}
